//package com.bins.cloud.gateway.config;
//
//import com.bins.cloud.gateway.job.MyElasticJob;
//import com.dangdang.ddframe.job.config.JobCoreConfiguration;
//import com.dangdang.ddframe.job.config.simple.SimpleJobConfiguration;
//import com.dangdang.ddframe.job.lite.api.JobScheduler;
//import com.dangdang.ddframe.job.lite.config.LiteJobConfiguration;
//import com.dangdang.ddframe.job.lite.spring.api.SpringJobScheduler;
//import com.dangdang.ddframe.job.reg.base.CoordinatorRegistryCenter;
//import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperConfiguration;
//import com.dangdang.ddframe.job.reg.zookeeper.ZookeeperRegistryCenter;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//
//@Configuration
//public class ElasticJobConfig {
//
//    @Bean
//    public CoordinatorRegistryCenter registryCenter() {
//        ZookeeperConfiguration zookeeperConfiguration = new ZookeeperConfiguration("localhost:2181", "test-job-dev");
//        CoordinatorRegistryCenter registryCenter = new ZookeeperRegistryCenter(zookeeperConfiguration);
//        registryCenter.init();
//        return registryCenter;
//    }
//
//    @Bean(initMethod = "init")
//    public JobScheduler simpleJobScheduler(CoordinatorRegistryCenter registryCenter, MyElasticJob myElasticJob) {
//        LiteJobConfiguration simpleJobConfig = LiteJobConfiguration.newBuilder(new SimpleJobConfiguration(
//                JobCoreConfiguration.newBuilder("demoSimpleJob", "0/1 * * * * ?", 10).build(),
//                myElasticJob.getClass().getCanonicalName())).build();
//        return new SpringJobScheduler(myElasticJob, registryCenter, simpleJobConfig);
//    }
//}